package com.star.common.sms.service;

import org.springframework.util.StringUtils;

import java.util.Map;

/**
 * sms抽象缓冲层
 *
 * @author zhouhengzhe
 * @version 1.0
 * @date 2023/6/25 14:15
 */
public abstract class AbstractSmsClient implements SmsClient {

    public void checkParam(String phoneNumber,
                           String template,
                           Map<String, String> templateParams,
                           String signName) {
        if (StringUtils.isEmpty(phoneNumber)) {
            throw new RuntimeException("手机号码不能为空");
        }
        if (StringUtils.isEmpty(template)) {
            throw new RuntimeException("模板不能为空");
        }
        if (templateParams.size() == 0) {
            throw new RuntimeException("模板填充内容不能为空");
        }
        if (StringUtils.isEmpty(signName)) {
            throw new RuntimeException("签名不能为空");
        }
    }
}
